package com.gao.service.impl;

import com.gao.dao.DeptDao;
import com.gao.pojo.Dept;
import com.gao.service.DeptService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DeptServiceImpl implements DeptService {

    @Resource
    private DeptDao deptDao;


    public Dept getDept(Integer id) {
        Dept dept = deptDao.getDept(id);

        if (dept == null) {
            throw new RuntimeException();
        }

        return dept;
    }

    public List<Dept> getDeptAll() {
        return deptDao.getDeptAll();
    }

    public void addDept(Dept dept) {
        deptDao.addDept(dept);
    }
}
